function RetInterval(datetime, postedMetos) {
    Dt = new Date(parseInt(datetime.substr(6)));
    today=new Date();
	var one_day=1000*60*60*24;
	var diff = today.getTime() - Dt.getTime();
	totmin = diff / 60000;
    var durat=postedMetos + " ";
	if (totmin <= 59) {
	    durat += Math.round(totmin) + " Minutes ago";
	}
	if (totmin >= 60 && totmin <= 1440) {
	    var hr = totmin / 60;
	    durat += Math.round(hr) + " Hours ago";
	}
	if (totmin >= 1440) {
	    var dy = totmin / 60;
	    dy = dy / 24;
	    durat += Math.round(dy) + " Days ago";
	}
	return durat;
}

function RetWant(want,IsAuthenticated,LoggedInUser)
{
	var retvWant='';
	retvWant+="<div class='wiwi-pitches-box'>";
	retvWant+="<div class='left-col'>";
        retvWant+="<a href='Home/UserPublicProfile?Uid=" + want.UserID + "' ><img src='/Home/ShowUserImage?Uid=" + want.UserID.toString() + "' width='48' height='48' alt='userName' /></a>";
        retvWant+="</div>";
    	retvWant+="<div class='right-col bigger-icon'>";
        if (IsAuthenticated=="1")
        {
            if (LoggedInUser != want.UserID.toString())
            {
            retvWant+="<ul class='user-choice'>";
			retvWant+="<li><a href='/Want/Meto?Wid=" + want.WantID + "' class='button-s me2'>Me2 !</a></li>";
			retvWant+="<li><a href='/Want/Pitch?Wid=" + want.WantID + "' class='button-s pitch'>Pitch !</a></li>";
		    retvWant+="</ul>";
            }
        }
        else
        {
			retvWant+="<ul class='user-choice'>";
				retvWant+="<li><a href='/Want/Meto?Wid=" + want.WantID + "' class='button-s me2'>Me2 !</a></li>";
				retvWant+="<li><a href='/Want/Pitch?Wid=" + want.WantID + "' class='button-s pitch'>Pitch !</a></li>";
			retvWant+="</ul>";
        }

            retvWant += "<h5>" + want.FName.toString(); if (want.Lname != null) { want.Lname.toString(); }
            retvWant+="<br />";
               if (want.WiwiDate != null)
               {
                   if (want.IsCreator == true) {
                       retvWant += "<span >" + RetInterval(want.WiwiDate, "Posted") + "</span>";
                   }
                   else {
                       retvWant += "<span >" + RetInterval(want.WiwiDate, "Me2'd") + "</span>";
                   }
                   
               }
               retvWant+="</h5>";
       		retvWant+="<p><a href='Home/WiwiDetails?wntID=" + want.WantID + "&UsrID=" + want.UserID + "' >" + want.WantDesc + "</a></p>";
            retvWant+="<p class='tagged'>Tagged ~ ";
             if (want.Tags != "")
             {
                 var TagRows = want.Tags.split('$');
                 for(k=0;k<TagRows.length;k++)
                 {
                     if (TagRows[k] != "")
                     {
                         var Tagss = TagRows[k].split('?');
                         if (Tagss[0] != "")
                         {
                             retvWant += "<a href='/Want/Pitch?Wuid=" + Tagss[1] + "'>" + Tagss[0] + "</a>";
                         }
                     }
                 }
             }
             retvWant+="</p>";              
             retvWant+="<div class='also-want grid_7'>"
    	    if(want.WantbyUsr != "")
         {
             retvWant+="<p class='move-left'>Also <br />wanted by</p>";
             var cntusrs = want.WantbyUsr.split('$');
             var usrs = cntusrs[0].split('?');
             if (cntusrs.Length > 1)
             {
                 if (cntusrs[1] > 0)
                 {
                     retvWant += "<p class='move-right'>";
                    retvWant+="<a href='Home/UserPublicProfile?Uid=" + want.UserID + "' class='xOthers'>and " + cntusrs[1] + " others.</a></p>";
                 }
             }
             for(k=0;k<usrs.length;k++)
             {
                 if (usrs[k] != "")
                 {
                     retvWant += "<a href='Home/UserPublicProfile?Uid=" + usrs[k] + "' ><img src='/Home/ShowUserImage?Uid=" + usrs[k] + "' width='32' height='32' /></a>";
                 }
             }
         }
             retvWant+="</div>";
	    retvWant+="</div>";
	retvWant+="</div>";
return retvWant;
}